given a biased coin, how to obtain fair flips?
Method: flip the coin twice if both flips are identical, repeat if both are different, use second flip as result experiment
In [ ]:
# Q1: expected number of X pair-flips? (as a function of the coin bias p_heads)
# E[X] = Psuccess + (1-Psuccess)(1+E[X])
# = Psuccess + 1 + E[X] - Psuccess -Psuccess*E[X]
# E[X] = 1/Psuccess
# E[X] = 1/(2*p*(1-p))
In [3]:
import pylab
import matplotlib.pyplot as plt
%matplotlib inline
pylab.rcParams['figure.figsize'] = (20.0, 8.0) #adjust to your screen
In [ ]: